package team.first.moiveapiv1.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import team.first.moiveapiv1.domain.Comment;
import team.first.moiveapiv1.mapper.CommentMapper;
import team.first.moiveapiv1.service.CommentService;
import team.first.moiveapiv1.vo.ResponseComment;

import java.util.List;

/**
 * @Author: HAPPY
 * @Project_name: project
 * @Package_name: team.first.moiveapiv1.service.impl
 * @Date: 2021/11/25 11:00
 * @Description：
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements CommentService {

    @Autowired
    CommentMapper commentMapper;

    @Override
    public List<ResponseComment> findAllCommentsByMovieId(Integer id) {
        // 接口返回的数据有分页信息，很奇怪，这里默认一下
        int pageSize = 20;
        int offset = 0;
        return commentMapper.selectAllCommentsByMovieId(id, pageSize, offset);
    }
}

